package com.highcom.mapper.oneToOne;

import com.highcom.bean.Card;
import com.highcom.bean.Person;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CardMapper {
    @Select("select * from card")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "number",property = "number"),
            @Result(
                    property = "p",
                    javaType = Person.class,
                    column = "pid",
//                    one @One 一对一固定写法
                    one = @One(select = "com.highcom.mapper.oneToOne.PersonMapper.selectById")
            )
    })
    public List<Card> selectAll();
}

